package com.mo.manage;

import jakarta.annotation.Resource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.Collection;

/**
 * @author mo
 * version
 */
@Component
public class RedisManager {

    @Resource
    private RedisTemplate redisTemplate;

    public Object getValue(String key){
       return redisTemplate.opsForList().range(key,0,-1);
    }
    public <T> Object setValue(String key, Collection<T> data){
        Object[] t =new Object[data.size()];
        data.toArray(t);
        return redisTemplate.opsForList().leftPushAll(key,t);
    }
}
